#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
using namespace std;

class Date
{
private:
    int _year;
    int _month;
    int _day;
public:
    Date(int year, int month, int day)
    {
        _year = year;
        _month = month;
        _day = day;
    }
    Date(int year, int d)
    {
        _year = year;
        _month = 1;
        _day = 0;
        count(d);
    }
    void count(int d)
    {
        int pd[13] = { -1,31,28,31,30,31,30,31,31,30,31,30,31 };
        if ((_year % 4 == 0) && (_year % 100 != 0) || (_year % 400 == 0))
            pd[2] = 29;
        _day += d;
        while (_day > pd[_month])
        {

            _day -= pd[_month];
            _month++;
            if (_month > 12)
            {
                _year++;
                _month = 1;
                if ((_year % 4 == 0) && (_year % 100 != 0) || (_year % 400 == 0))
                    pd[2] = 29;
                else
                    pd[2] = 28;
            }
        }
        print();
    }
    void print()
    {
        if (_month < 10)
        {
            if (_day < 10)
                cout << _year << '-' << 0 << _month << '-' << 0 << _day << endl;
            else
                cout << _year << '-' << 0 << _month << '-' << _day << endl;
        }
        else
        {
            if (_day < 10)
                cout << _year << '-' << _month << '-' << 0 << _day << endl;
            else
                cout << _year << '-' << _month << '-' << _day << endl;;
        }
    }
};

int main()
{
    int year = 0;
    int d = 0;
    while (scanf("%d %d", &year, &d) != EOF)
    {
        Date date(year, d);
    }
    return 0;
}
